import { InjectionKey } from 'vue'
import { createStore, useStore as baseUseStore, Store } from 'vuex'
import { VmsUser } from '../_types/sys/user'
import user from './modules/user'
import sysconfig from './modules/sysconfig'
import { SysConfig } from '../_types/sys/sysconfig'


export interface RootState {
    user: VmsUser,
    sysconfig: SysConfig
}

export const key: InjectionKey<Store<RootState>> = Symbol()

export const store = createStore<RootState>({
    modules: {
        user,
        sysconfig
    }
})

export function useStore() {
    return baseUseStore(key)
}